import request from '@/utils/http'
import { commonApi, reqestMethod } from "@/utils/api"
import { DictionaryType, IAddFileToKnowLedgeBaseParams, IDepartmentAdminInfo, IGetFileListByBaseIdParams, IKnowLedgeBase, IKnowLedgeBaseInfo, IMemberAdminInfo, IResponseData, IRoleAdminInfo, ISettingInfo, IUpdateKnowLedgeBaseParams, IMemberAdminListParams, IUnbindRoleMemberParams, IFileAttributeInfo, IAddMirrorParams, IAddDiskParams, ISystemRestoreParams, ISetBackupPlanParams, ISystemUpgradeParams, IEditDocumentOwnerParams, IOperateLogListParams, IFileClassInfo, IFileClassAttrInfo, IGetMultiClassAttributesParams, IAddAttributeMetaFromClassParams } from "@/models/common"
import { IConfigParams, IVerificationCodeParams } from '@/models/user'

/**
 * @description 获取sm2加密信息，无需参数
 * @returns {object} 返回public_key
 */
export function getSecretKey<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getsecretkey_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * @description 根据租户id获取登录页面的logo和title等配置信息
 * @param {string} params.tenant_id  租户id
 * @returns 返回该租户的配置信息，包括PC和手机端
 */
export function getConfig<T>(data: IConfigParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getconfig_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * @description 获取短信验证码
 * @param {string} params.phone_number 手机号
 * @param {number} params.type 0：登录验证码，1：重置密码验证码
 * @returns 返回本次验证码的uuid
 */
export function getVerificationCode<T>(data: IVerificationCodeParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getverificationcode_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取系统管理菜单
 */
export function getAdminMenu<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getadminmenu_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 更新租户参数
 */
export function updateSettingString<T>(data: ISettingInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.updatesettingstring_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 更新租户图标-axios上传图片函数封装-主要用于手动上传图片的场景，Upload组件可以配置自动上传用不到此函数
 */
export function updateSettingImage<T>(data: FormData): Promise<IResponseData<T>> {
  return request({
    url: commonApi.updatesettingimage_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取租户配置
 */
export function getTenantConfig<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.gettenantconfig_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取数据字典类型列表
 */
export function getDictionaryTypeList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getdictionarytype_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 添加数据字典类型
 */
export function addDictionaryType<T>(data: DictionaryType): Promise<IResponseData<T>> {
  return request({
    url: commonApi.adddictionarytype_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除数据字典类型
 */
export function deleteDictionaryType<T>(data: DictionaryType): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deletedictionarytype_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 更新数据字典类型
 */
export function updateDictionaryType<T>(data: DictionaryType): Promise<IResponseData<T>> {
  return request({
    url: commonApi.updatedictionarytype_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取数据字典选择项列表
 */
export function getDictionaryItems<T>(data: DictionaryType): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getdictionaryitems_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 更新数据字典选择项列表
 */
export function updateDictionaryItem<T>(data: DictionaryType): Promise<IResponseData<T>> {
  return request({
    url: commonApi.updatedictionaryitem_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取知识库列表
 */
export function getKnowLedgeBaseList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getknowledgebaselist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取知识库列表
 */
export function getKnowLedgeBaseAdminList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getknowledgebaseadminlist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 新增知识库
 */
export function addKnowLedgeBase<T>(data: IKnowLedgeBaseInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addknowledgebase_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除知识库
 */
export function deleteKnowLedgeBase<T>(data: IKnowLedgeBase): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deleteknowledgebase_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 更新知识库
 */
export function updateKnowLedgeBase<T>(data: IUpdateKnowLedgeBaseParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.updateknowledgebase_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 根据知识库id获取文档列表
 */
export function getFileListByBaseId<T>(data: IGetFileListByBaseIdParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getfilelistbybaseid_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 向知识库中添加文件
 */
export function addFileToknowLedgeBase<T>(data: IAddFileToKnowLedgeBaseParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addfiletoknowledgebase_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 从指定知识库中删除文件
 */
export function deleteFileFromKnowLedgeBase<T>(data: IAddFileToKnowLedgeBaseParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deletefilefromknowledgebase_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取角色列表
 */
export function getRoleAdminList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getrolelist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 添加角色
 */
export function addRoleAdmin<T>(data: IRoleAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addrole_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 编辑角色信息
 */
export function editRoleAdminInfo<T>(data: IRoleAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.editroleinfo_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除角色
 */
export function deleteRoleAdmin<T>(data: IRoleAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deleterole_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取成员管理的部门列表
 */
export function getDepartmentAdminList<T>(data: IDepartmentAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getdepartmentlist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取成员管理的全部部门列表
 */
export function getAllDepartmentAdminList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getdepartmenttreelist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 添加成员管理的部门
 */
export function addDepartmentAdmin<T>(data: IDepartmentAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.adddepartment_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 编辑成员管理的部门
 */
export function editDepartmentAdminInfo<T>(data: IDepartmentAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.editdepartmentinfo_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除成员管理的部门
 */
export function deleteDepartmentAdmin<T>(data: IDepartmentAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deletedepartment_url,
    data,
    method: reqestMethod.POST
  })
}

/**
 * 获取成员列表
 */
export function getMemberAdminList<T>(data: IMemberAdminListParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getuserlist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 添加成员
 */
export function addMemberAdmin<T>(data: IMemberAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.adduser_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 编辑成员
 */
export function editMemberAdmin<T>(data: IMemberAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.edituserinfo_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除成员
 */
export function deleteMemberAdmin<T>(data: IMemberAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deleteuser_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 重置成员密码
 */
export function resetMemberAdminPwd<T>(data: IMemberAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.resetpasswordbyadmin_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 根据角色id获取用户列表
 */
export function getRoleMemberList<T>(data: IRoleAdminInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getroleuserlist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 解除绑定用户和角色
 */
export function unBindRoleMember<T>(data: IUnbindRoleMemberParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.unbindroleuser_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取文件属性管理列表
 */
export function getFileAttributeAdminList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getattributemetalist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 新增文件属性
 */
export function addFileAttribute<T>(data: IFileAttributeInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addattributemeta_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除文件属性
 */
export function deleteFileAttribute<T>(data: IFileAttributeInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deleteattributemeta_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 修改文件属性
 */
export function updateFileAttribute<T>(data: IFileAttributeInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.updateattributemeta_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取全部数据字典
 */
export function getAllDictionaryTypes<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getalldictionarytypes_url,
    data,
    method: reqestMethod.POST
  })
}

/**
 * 硬件的监控信息
 */
export function getMonitor<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getmonitor_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 存储池信息
 */
export function getStoreStatus<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getstorestatus_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 添加磁盘镜像
 */
export function addMirror<T>(data: IAddMirrorParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addmirror_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 从镜像移除一个磁盘
 */
export function removeDisk<T>(data: IAddDiskParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.removedisk_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 向镜像添加一个磁盘
 */
export function addDisk<T>(data: IAddDiskParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.adddisk_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 返回备份状态
 */
export function getBackupStatus<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getbackupstatus_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 创建备份计划
 */
export function setBackupPlan<T>(data: ISetBackupPlanParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.setbackupplan_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 立即备份
 */
export function systemBackup<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.systembackup_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 恢复数据
 */
export function systemRestore<T>(data: ISystemRestoreParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.systemrestore_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 系统升级
 */
export function systemUpgrade<T>(data: ISystemUpgradeParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.systemupgrade_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取所有人员列表
 */
export function getAllUserList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getalluserlist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 更改文档拥有人
 */
export function editDocumentOwner<T>(data: IEditDocumentOwnerParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.editdocumentowner_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取操作日志列表
 */
export function getOperateLogList<T>(data: IOperateLogListParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getoperateloglist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取表单快捷方式列表（管理员端）
 */
export function getFrmShortcutList<T>(data: null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getfrmshortcutlist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 新增文件分类信息
 */
export function addFileClass<T>(data: IFileClassInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addfileclass_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 修改文件分类信息
 */
export function editFileClass<T>(data: IFileClassInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.editfileclass_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除文件分类信息
 */
export function deleteFileClass<T>(data: IFileClassInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deletefileclass_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取分类列表
 */
export function getFileClassList<T>(data:null): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getfileclasslist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 新增分类属性
 */
export function addClassAttribute<T>(data: IFileClassAttrInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addclassattribute_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 编辑分类属性
 */
export function editClassAttribute<T>(data: IFileClassAttrInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.editclassattribute_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 删除分类属性
 */
export function deleteClassAttribute<T>(data: IFileClassAttrInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.deleteclassattribute_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取分类属性列表
 */
export function getClassAttributeList<T>(data: IFileClassAttrInfo): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getclassattributelist_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 获取多选文件分类情况下的属性列表
 */
export function getMultiClassAttributes<T>(data: IGetMultiClassAttributesParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.getmulticlassattributes_url,
    data,
    method: reqestMethod.POST
  })
}
/**
 * 从分类属性中添加文件属性
 */
export function addAttributeMetaFromClass<T>(data: IAddAttributeMetaFromClassParams): Promise<IResponseData<T>> {
  return request({
    url: commonApi.addattributemetafromclass_url,
    data,
    method: reqestMethod.POST
  })
}